<if condition="IS_AJAX">
      <volist name="list" id="vo">
          <div class="panel">
            <div class="panel-heading">
              <div class="panel-title"> 
              	<a class="accordion-toggle collapsed" data-parent="#accordion" data-toggle="collapse" href="#collapse{$vo.id}">
                	<div class="pull-right text-<?php echo $vo['changenum']>0?'success':'danger' ?>">{$vo.changenum}</div>{$vo.name} 
                </a> 
              </div>
            </div>
            <div class="panel-collapse collapse" id="collapse{$vo.id}" style="height: 0;">
              <div class="panel-body ui-table-split" style="margin-bottom:10px;" >
                <div class="pull-right">
                  <button id="modify" class="btn-xs btn-primary-outline modify update" data-id='{$vo['id']}' href="{:U('update',array('id'=>$vo['id']))}" key="{$key}">修改</button>
                </div>
                <div><span class="glyphicon glyphicon-time text-primary" aria-hidden="true"><strong>规 则：</strong></span><font class="changenum{$key}">{$vo['type_name']}</font></div>
                <div><span class="glyphicon glyphicon-time text-primary" aria-hidden="true"><strong>职 员：</strong></span><font class="changenum{$key}">{$vo['name']}</font></div>
                <div><span class="glyphicon glyphicon-time text-primary" aria-hidden="true"><strong>积 分：</strong></span><font class="changenum{$key}">{$vo['changenum']}</font></div>
                <div><span class="glyphicon glyphicon-time text-primary" aria-hidden="true"><strong>时 间：</strong></span><font class="time{$key}">{:date('Y-m-d',$vo['time'])}</font></div>
                <div><span class="glyphicon glyphicon-list text-primary" aria-hidden="true"><strong>状 态：</strong></span>
                	<eq name="vo['statu_id']" value="1"><span class="label label-success">已批准</span></eq>
                    <eq name="vo['statu_id']" value="3"><span class="label label-warning">审核中</span></eq>
                    <eq name="vo['statu_id']" value="2"><span class="label label-danger">被拒绝</span></eq>
                </div>
              </div>
            </div>
          </div>
      </volist>
<else/>
    <include file="Public:header" /> <include file="Public:navgation" />
    <div class="container-fluid main-content">
      <div class="page-title chart-container"> </div>
      <div class="row">
        <div class="col-md-12">
          <div class="widget-container">
            <div class="heading"> <i class="icon-bar-chart"></i>积分申请 <a class="btn btn-default btn pull-right" data-toggle="modal" href="#myModal2" >筛选</a>
              <if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log_apply', 'insert')"> <a class="btn btn-primary btn pull-right f-fillwidth" data-toggle="modal" href="#myModal">添加申请</a> </if>
            </div>
            <div class="widget-content padded modal-open">
              <if condition="!isMobile()">
                  <table id="datatable-editable" class="table table-striped table-bordered dataTable">
                    <thead>
                      <tr>
                        <th class="minwidth60">职员</th>
                        <th>积分</th>
                        <th class="hidden-xs">规则</th>
                        <th class="hidden-sm hidden-xs">时间</th>
                        <th class="minwidth60 maxwidth60">状态</th>
                        <th class="minwidth64"></th>
                      </tr>
                    </thead>
                    <volist name="list" id="vo" empty="$empty">
                      <tr class="data_list {$key}">
                        <td>{$vo.name}</td>
                        <td>{$vo.changenum}</td>
                        <td class="typeevent hidden-xs">{$vo.type_name}</td>
                        <td class="hidden-sm hidden-xs">{:date('Y-m-d',$vo['time'])}</td>
                        <td><eq name="vo['statu_id']" value="1"><span class="label label-success">已批准</span></eq>
                          <eq name="vo['statu_id']" value="3"><span class="label label-warning">审核中</span></eq>
                          <eq name="vo['statu_id']" value="2"><span class="label label-danger">被拒绝</span></eq></td>
                        <td class="text-center actions"><a class="table-actions fancybox" data-remark='{$vo.remark}' data-id='{$vo['id']}' href="#fancybox"><i class="icon-eye-open"></i></a>
                          <eq name="vo['member_id']" value="$userInfo['id']">
                            <if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log_apply', 'delete')"> <a class="delete-row table-actions" data-remark='{$vo.remark}' href="{:U('delete',array('id'=>$vo['id']))}" row="{$key}"><i class="icon-trash text-danger"></i></a> </if>
                          </eq>
                          <in name="vo['cid']" value="$userInfo['id']">
                            <eq name="vo['statu_id']" value="3">
                              <if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log_apply', 'update')"> <a class="table-actions update" data-id='{$vo['id']}' href="{:U('update',array('id'=>$vo['id']))}"><i class="icon-pencil"></i></a> </if>
                            </eq>
                            <eq name="vo['statu_id']" value="3">
                              <if condition="getAccessMenu($accessList, 'Intesys', 'Integral_log_apply', 'check')"> <a class="table-actions f-confirm-h" href="{:U('update',array('id'=>$vo['id'],'statu'=>1))}"><i class="icon-ok text-success"></i></a> <a class="table-actions f-confirm-h" href="{:U('update',array('id'=>$vo['id'],'statu'=>2))}"><i class="icon-remove text-danger"></i></a> </if>
                            </eq>
                          </in></td>
                      </tr>
                    </volist>
                  </table>
              <else/>
                    <div class="panel-group tbody" id="accordion"></div>
                    <script>
                        $(".tbody").more({'address':location.href});
                    </script>
              </if>
              <!--modal start-->
              <div class="modal fade" id="myModal3" style="display: none;" aria-hidden="true">
                <div class="modal-dialog">
                  <div class="modal-content">
                    <form method="post" name="formupdate" id="validate-form" class="form-horizontal" novalidate action="__URL__/update">
                      <div class="modal-header">
                        <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
                        <h4 class="modal-title">查看积分</h4>
                      </div>
                      <div class="modal-body">
                        <fieldset>
                          <div class="form-group">
                            <label class="control-label col-sm-2">积分规则</label>
                            <div class="col-sm-5 typeevent">
                              <select class="form-control integralruletype">
                                <foreach name="ruletypelist" item="vo">
                                  <option value="{$vo.id}">{$vo.name}</option>
                                </foreach>
                              </select>
                            </div>
                            <div class="col-sm-5">
                              <select class="form-control integralrule f-ruleinfo" name="rule_id">
                                <option value="Category 1">请选择</option>
                              </select>
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">积分类型</label>
                            <div  class="col-sm-10">
                              <select class="form-control" name="type_id">
                                <foreach name="integraltypelist" item="vo">
                                  <option value="{$vo.id}">{$vo.remark}</option>
                                </foreach>
                              </select>
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">审核人</label>
                            <div  class="col-sm-5">
                              <select class="form-control groupid" >
                                <option value="">选择部门</option>
                                <foreach name="grouplist" item="vo">
                                  <option value="{$vo.id}">{$vo.title}</option>
                                </foreach>
                              </select>
                            </div>
                            <div class="col-sm-5">
                              <select class="form-control memberid" name="pid">
                                <option value="">选择职员</option>
                              </select>
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">积分数量</label>
                            <div class="col-sm-10">
                              <input value="" class="form-control" name="changenum" placeholder="请输入数量" type="number">
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">奖/惩时间</label>
                            <div  class="col-sm-10" style="z-index:1050;">
                              <div class="input-group date datepicker" data-date-autoclose="true" data-date-format="dd-mm-yyyy">
                                <input value="" class="form-control" type="text" name="date">
                                <span class="input-group-addon"><i class="icon-calendar"></i></span> </div>
                            </div>
                          </div>
                          <div class="form-group"> 
                            <!--<label class="control-label col-sm-2">备注</label>-->
                            <div class="col-sm-12">
                              <html:editor id="editorr" name="remark" type="UEDIT" style="height:300px; width:100%;"></html:editor>
                            </div>
                          </div>
                        </fieldset>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-primary" type="submit">修改积分</button>
                        <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
              <!--modal start-->
              <div class="modal fade" id="myModal" style="display: none;" aria-hidden="true">
                <div class="modal-dialog">
                  <div class="modal-content">
                    <form method="post" name="form" id="validate-form" class="form-horizontal" novalidate action="__URL__/insert">
                      <div class="modal-header">
                        <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
                        <h4 class="modal-title">申请积分</h4>
                      </div>
                      <div class="modal-body">
                        <fieldset>
                          <!-- <div class="form-group">
                            <label class="control-label col-sm-2">积分规则</label>
                            <div class="col-sm-5 typeevent">
                                <select class="form-control integralruletype">
                                    <foreach name="ruletypelist" item="vo">
                                        <option value="{$vo.id}">{$vo.name}</option>
                                    </foreach>
                                </select>
                            </div>
                            <div class="col-sm-5">
                                <select class="form-control integralrule f-ruleinfo" name="rule_id">
                                    <option value="Category 1">请选择</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">积分类型</label>
                            <div  class="col-sm-10">
                                <select class="form-control" name="type_id">
                                    <foreach name="integraltypelist" item="vo">
                                        <option value="{$vo.id}">{$vo.remark}</option>
                                    </foreach>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-2">审核人</label>
                            <div  class="col-sm-5">
                                <select class="form-control groupid2" >
                                    <option value="">选择部门</option>
                                    <foreach name="grouplist" item="vo">
                                        <option value="{$vo.id}">{$vo.title}</option>
                                    </foreach>
                                </select>
                            </div>
                            <div class="col-sm-5">
                                <select class="form-control memberid2" name="pid">
                                    <option value="">选择职员</option>
                                </select>
                            </div>
                        </div>--> 
        <!--<div class="form-group">
                            <label class="control-label col-sm-2">积分数量</label>
                            <div class="col-sm-10">
                                <input class="form-control" name="changenum" placeholder="请输入数量" type="number">
                            </div>
                        </div>-->
                          <div class="form-group">
                            <div class="col-sm-10">
                              <div class="input-group">
                                <input readonly class="form-control f-fillname" type="text" placeholder="请选择审核人">
                                <input name="pid"  class="form-control" type="hidden">
                                <span class="input-group-btn">
                                <button class="btn btn-default fancybox" href="#fancybox2" type="button">选择</button>
                                </span> </div>
                            </div>
                          </div>
                          <div class="form-group">
                            <div  class="col-sm-10" style="z-index:1050;">
                              <div class="input-group date datepicker" data-date-autoclose="true" data-date-format="dd-mm-yyyy">
                                <input class="form-control" type="text" name="date" placeholder="请选择奖/惩时间">
                                <span class="input-group-addon"><i class="icon-calendar"></i></span> </div>
                            </div>
                          </div>
                          <div class="form-group"> 
                            <!--<label class="control-label col-sm-2">备注</label>-->
                            <div class="col-sm-12">
                              <html:editor id="editor" name="remark" type="UEDIT" style="height:300px; width:100%;"></html:editor>
                            </div>
                          </div>
                        </fieldset>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-primary" type="submit">添加积分</button>
                        <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
              <!-- modal end and modal2 start-->
              <div class="modal fade" id="myModal2" style="display: none;" aria-hidden="true">
                <div class="modal-dialog">
                  <div class="modal-content">
                    <form method="post" name="form" id="validate-form" class="form-horizontal" novalidate action="__URL__/index">
                      <div class="modal-header">
                        <button aria-hidden="true" class="close" data-dismiss="modal" type="button">×</button>
                        <h4 class="modal-title">规则筛选</h4>
                      </div>
                      <div class="modal-body">
                        <fieldset>
                          <div class="form-group">
                            <label class="control-label col-sm-2">职员部门</label>
                            <div  class="col-sm-5">
                              <select class="form-control groupid" name="groupid">
                                <option value="">选择部门</option>
                                <foreach name="grouplist" item="vo">
                                  <option value="{$vo.id}">{$vo.title}</option>
                                </foreach>
                              </select>
                            </div>
                            <div class="col-sm-5">
                              <select class="form-control memberid" name="member_id">
                                <option value="">选择职员</option>
                              </select>
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">积分规则</label>
                            <div class="col-sm-5 typeevent">
                              <select class="form-control integralruletype" name="ruletypeid">
                                <option value="">选择规则分类</option>
                                <foreach name="ruletypelist" item="vo">
                                  <option value="{$vo.id}">{$vo.name}</option>
                                </foreach>
                              </select>
                            </div>
                            <div class="col-sm-5">
                              <select class="form-control integralrule" name="rule_id">
                                <option value="">选择规则</option>
                              </select>
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">积分类型</label>
                            <div  class="col-sm-5">
                              <select class="form-control" name="type_id">
                                <option value="">选择类型</option>
                                <foreach name="integraltypelist" item="vo">
                                  <option value="{$vo.id}">{$vo.remark}</option>
                                </foreach>
                              </select>
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">奖/惩积分</label>
                            <div  class="col-sm-5">
                              <select class="form-control" name="rewardstype">
                                <option value="">选择分种</option>
                                <option value="1">加分</option>
                                <option value="2">减分</option>
                              </select>
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">日期范围</label>
                            <div class="col-sm-5" style="z-index:1050;">
                              <input name="starttime" class="form-control" data-date-autoclose="true" data-date-format="dd-mm-yyyy" id="dpd1" placeholder="开始日期" type="text">
                            </div>
                            <div class="col-sm-5" style="z-index:1050;">
                              <input name="endtime" class="form-control" data-date-autoclose="true" data-date-format="dd-mm-yyyy" id="dpd2" placeholder="结束日期" type="text">
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-sm-2">选择状态</label>
                            <div class="col-sm-5">
                              <select class="form-control" name="statu_id">
                                <option value="">选择状态</option>
                                <option value="3">审核中</option>
                                <option value="1">已批准</option>
                                <option value="2">已拒绝</option>
                              </select>
                            </div>
                          </div>
                        </fieldset>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-primary" type="submit">筛选</button>
                        <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
                      </div>
                    </form>
                  </div>
                </div>
              </div>
              <!-- modal end and fancybox start-->
              <div id="fancybox" class="modal-dialog" style="display: none;">
                <h4 class="text-muted">查看</h4>
                <ul class="no-style">
                </ul>
              </div>
              <!-- fancybox end and fancybox start-->
              <div id="fancybox2" style="display: none;">
                <ul class="nav nav-tabs" role="tablist">
                  <foreach name="memberlist" item="vo">
                    <li role="presentation"><a href="#{$key}" aria-controls="{$key}" role="tab" data-toggle="tab">{$key}</a></li>
                  </foreach>
                </ul>
                
                <!-- Tab panes -->
                <div class="tab-content" style="min-height:160px">
                  <foreach name="memberlist" item="vo">
                    <div role="tabpanel" class="tab-pane" id="{$key}">
                      <foreach name="vo" item="ko">
                        <label class="checkbox-inline">
                          <input name="staff" type="checkbox" value="{$ko.id}">
                          <span>{$ko.name}</span></label>
                      </foreach>
                    </div>
                  </foreach>
                </div>
                <div class="col-xs-12">
                  <label class="checkbox-inline checkall">
                    <input type="checkbox">
                    <span>全选</span></label>
                  <button class="btn btn-primary btn-md pull-right f-getstaff">确定</button>
                </div>
              </div>
              <!-- fancybox end --> 
            </div>
          </div>
        </div>
      </div>
    </div>
    <script>   
    $(".widget-content").on("click",".update",function(e) {
        e.preventDefault();
        $("#myModal3 form").attr("action",$(this).attr("href"));
        $("#myModal3 .form-group").find('[name="changenum"]').val(Number($(this).parents(".data_list").find("td:eq(2)").html()));
        $("#myModal3 .form-group").find('[name="date"]').val($(this).parents(".data_list").find("td:eq(3)").html());
        $.getJSON("__URL__/getinfo",{'id':$(this).attr('data-id')},function(data){
            if(data.statu==1){
               $("#myModal3 .form-group  #editorr #ueditor_0").contents().find("body p").html(data.info['remark']); 
            }    
        });
        $("#myModal3").modal("show");
        
    }); 
    $(".fancybox").click(function(e) {
        $.getJSON("__URL__/getinfo",{'id':$(this).attr('data-id')},function(data){
            if(data.statu==1){
               $("#fancybox ul").append("<p><span class='text-primary'>内容:</span> "+data.info['remark']+"</p>");    
            }    
        });
    });
    $(".f-confirm-h").click(function(e) {
        var href=$(this).attr("href");
        var hash=$("#myModal input[name='__hash__']").attr("value");
        console.log(hash);
        $(this).attr("href",$(this).attr("href").replace('.html','/__hash__/'+hash+'.html'));
        if(!confirm('您确定要进行此操作吗？')){ 
            e.preventDefault(); 
            $(this).attr("href",href);
            return;
        }
    });
    </script> 
    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script> 
    <include file="Public:footer" />
</if>